- has_voted = logged_in? && poll.voted?(current_user)

.clearfix
  %h2
    = poll.question
    %small
      =:total_votes.l
      %span.badge.badge-info
        = poll.votes.size
        
  %table.table.poll
    -poll.choices.each do |choice|     
      %tr
        
        -if @is_current_user || has_voted
          %td
            .progress
              .progress-bar.progress-bar-success{:style => "width:#{choice.votes_percentage}%"}
                =choice.votes_percentage
                \%
        -else
          %td
            - if logged_in? && !has_voted
              = link_to :vote.l, votes_path(:choice_id => choice), :method => :post, :class => 'act-via-ajax'
            - elsif !logged_in?
              = link_to :vote.l, new_vote_path(:post_id => poll.post.id), {:title => :log_in_to_vote.l, :class => 'vote'}
        %td= choice.description
  -if !has_voted
    %p
      = :you_must_vote_to_see_the_results.l
  -elsif logged_in?
    %p
      = :you_have_already_voted.l
